# word_list.py
# A alphabet indexed chinese dictionary

def load():
	# the global list for chinese phases
	word_list = dict()
	# the dictionary in plain text format
	dict_file = './word_list.txt'

	with open(dict_file, 'rb') as f:
		bytes = f.read()
		s = bytes.decode('utf-8')
		pairs = s.split('\n')
		for pair_ in pairs:
			if not pair_.startswith('#'):
				key, val = pair_.split('-')
				word_list[key] = val

	return word_list

def test_load():
	words = load()
	print('\n===== TEST RESULT =====')
	print(words['hualiaoshi'])
	print(words['zhudong'])
	print('=======================')